package com.zhujiaji.common;

import lombok.Builder;
import lombok.Data;

/**
 * @author 朱佳吉
 * @date 2024/3/16 17:19
 */
@Data
@Builder
public class Result<T> {
    private Integer code;
    private String message;
    private T data;

    public static <T> Result<T> ok(T data) {
        return (Result<T>) Result.builder().code(200).message("成功").data(data).build();
    }

    public static <T> Result<T> error(String message) {
        return Result.<T>builder().code(500).message(message).build();
    }
}
